package com.app.biz.controller;

import cn.hutool.core.lang.tree.Tree;
import com.app.biz.service.ISysAreaService;
import com.app.common.annotation.Anonymous;
import com.app.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/biz/area")
public class SysAreaController {

    private final ISysAreaService sysAreaService;

    public SysAreaController(ISysAreaService sysAreaService) {
        this.sysAreaService = sysAreaService;
    }

    @Anonymous
    @GetMapping("/getAreaTree")
    public AjaxResult getAreaTree(){
        List<Tree<String>> areaTree = sysAreaService.getAreaTree();
        return AjaxResult.success(areaTree);
    }

}
